﻿using Furion.DynamicApiController;
using HOPU.OnlineSchool.Application.Files.Dtos;
using HOPU.OnlineSchool.Application.Files.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HOPU.OnlineSchool.Application.Files
{
    /// <summary>
    /// 上传文件
    /// </summary>
    public class FileAppService : IDynamicApiController
    {
        private readonly IFileService _fileService;

        public FileAppService(IFileService fileService)
        {
            this._fileService = fileService;
        }
       
        /// <summary>
        /// 上传文件
        /// </summary>
        /// <param name="file"></param>
        /// <param name="host"></param>
        /// <returns></returns>
        /// /api/file/upload/a
        [HttpPost("/api/file/upload")]
        public FileUploadDto Upload(IFormFile file, string host)
        {
           return _fileService.FileUpload(file, host);
        }
    }
}
